home *** CD-ROM | disk | FTP | other *** search
- head 1.8;
- branch ;
- access ;
- symbols ;
- locks ;
- comment @@;
-
-
- 1.8
- date 92.03.01.10.26.49; author melling; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 92.03.01.05.07.31; author melling; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 92.02.29.20.35.38; author melling; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 92.02.28.05.18.47; author melling; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 91.12.19.10.12.33; author melling; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 91.12.16.17.21.59; author melling; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 91.12.07.07.48.53; author melling; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 91.12.07.03.36.47; author melling; state Exp;
- branches ;
- next ;
-
-
- desc
- @Tetris 1.1
- @
-
-
- 1.8
- log
- @Release 1.3
- @
- text
- @/*
- * The View that displays the next piece that will drop.
- *
- */
- #import <appkit/Application.h>
- #import <appkit/NXImage.h>
- #import <appkit/Button.h>
- #import "NextMatrix.h"
- #import "Piece.h"
-
- @@implementation NextMatrix
-
- - initFrame:(const NXRect *)frameRect
- {
- NXSize size;
- extern resize(NXSize *);
-
- [super initFrame:frameRect numRows:0 numCols:0];
-
- thePiece = [[Piece alloc] init];
- [thePiece newPiece];
-
- [thePiece getBlockSize:&size];
- resize(&size);
- [super setElementSize:&size]; // Remember the image's size.
- pieceVisible = showNext = NO;
- size.width = size.height = 1.0;
- [super setIntercell:&size];
-
- #ifdef DEBUG
- fprintf(stderr, "NextMatrix initialized\n");
- #endif
- return self;
- }
-
-
- - drawSelf:(const NXRect *)rects :(int)rectCount
- {
- [super drawSelf:rects :rectCount];
- fprintf(stderr, "Thinking about showing you the next piece\n");
- if (pieceVisible && showNext) {
- fprintf(stderr, "Here's the next piece.\n");
- [thePiece draw:self]; // Show the next piece
- }
- return self;
- }
-
-
- - (struct pieceInfo *)pieceInfo
- {
- struct pieceInfo *info;
- #ifdef DEBUG
- puts("NextMatrix instance creating a new piece");
- #endif
- info = [thePiece pieceInfo];
- [thePiece newPiece]; // Generate the new piece
-
- [self display];
- return info;
- }
-
- /*
- * TetApp will inform us when the game has started.
- */
- - start:sender
- {
- [thePiece newPiece];
- pieceVisible = YES;
- return self;
- }
-
- /*
- * TetApp will inform us when the game has been stopped.
- */
- - end:sender
- {
- pieceVisible = NO;
- [self display];
- return self;
- }
-
- - showNext:sender
- {
- showNext = [showNextSwitch state];
- if (pieceVisible)
- [self display];
- return self;
- }
-
-
- - free
- {
- [thePiece free];
- return [super free];
- }
-
- @@end
- @
-
-
- 1.7
- log
- @*** empty log message ***
- @
- text
- @d26 1
- a26 1
-
- a29 1
- pieceVisible = showNext = NO;
- d36 1
- d84 1
- a84 1
- showNext = [sender state];
- @
-
-
- 1.6
- log
- @*** empty log message ***
- @
- text
- @a47 6
- - start:sender
- {
- [thePiece newPiece];
- pieceVisible = YES;
- return self;
- }
- d62 13
- d77 3
- a79 3
- pieceVisible = NO;
- [self display];
- return self;
- @
-
-
- 1.5
- log
- @*** empty log message ***
- @
- text
- @d20 4
- a23 1
- [[NXImage findImageNamed:"Block1"] getSize:&size];
- a29 3
- thePiece = [[Piece alloc] init];
- [thePiece newPiece];
-
- d31 3
- d40 5
- a44 3
-
- if (pieceVisible && showNext)
- [thePiece draw:self]; // Show the next piece
- d62 1
- a62 1
- [thePiece newPiece];
- @
-
-
- 1.4
- log
- @*** empty log message ***
- @
- text
- @d16 1
- @
-
-
- 1.3
- log
- @*** empty log message ***
- @
- text
- @d20 1
- a57 3
- #ifdef DEBUG
- [[NXApp getCheater] setPiece:thePiece];
- #endif
- a76 8
- /*
- * Tell the piece to call the cheater to determine the next block to drop.
- */
- - setCheating:sender
- {
- [thePiece setCheating:[sender intValue]];
- return self;
- }
- @
-
-
- 1.2
- log
- @Tetris 1.2
- @
- text
- @d5 1
- d18 1
- d20 2
- a21 1
- [self setElementSize:&size];
- d23 1
- a23 1
- [self setIntercell:&size];
- d37 1
- a37 1
- [thePiece draw:self];
- d51 3
- d56 4
- d73 13
- a85 4
- showNext = [sender state];
- if (pieceVisible)
- [self display];
- return self;
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d1 4
- a4 1
-
- d15 1
- a15 1
-
- d21 1
- d24 1
- d32 1
- @
-